<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;

class ElectricWater extends Model
{
    public $timestamps = false;
    protected $connection = 'mysql_center';
    protected $table = 'electric_water';

    /**
     * @return HasOne
     */
    public function one_collector(): HasOne
    {
        return $this->hasOne(ElectricCollector::class, 'id', 'collect_id')->selectRaw("id,name");
    }

    /**
     * @return HasOne
     */
    public function one_plan(): HasOne
    {
        return $this->hasOne(ElectricChargingScheme::class, 'id', 'charge_id')->selectRaw('id,plan_title');
    }

    /**
     * @return HasOne
     */
    public function one_alarm(): HasOne
    {
        return $this->hasOne(ElectricAlarmPlan::class, 'id', 'alarm_id')->selectRaw('id,plan_title');
    }
}
